﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>">
	<!-- jsp文件头和头部 -->
	<%@ include file="../main/main_top.jsp"%> 
	</head> 
<body>
<div class="container-fluid" id="main-container">
	<div id="page-content" class="clearfix">
		<div class="row-fluid">
				<!-- 检索  -->
				<form action="tableMenu/listTableMenuData.do" method="post" name="tableMenuForm" id="tableMenuForm">
				<input type="hidden" name="currentselecttableconstantsid" id="currentselecttableconstantsid" value="${pageData.currentselecttableconstantsid }"/>
				<input type="hidden" name="org_id" id="org_id" value="${pageData.org_id }"/>
				<table id="table_report" class="table table-striped table-bordered table-hover">
					<thead>
						<tr>
							<th>序号</th>
							<th>类型名称</th>
							<th>产品名称</th>
							<th><i class="icon-time hidden-phone"></i>创建时间</th>
							<th>创建人</th>
							<th class="center">操作</th>
						</tr>
					</thead>
					<tbody>
						
					<!-- 开始循环 -->	
					<c:choose>
						<c:when test="${not empty tableMenuList}">
							<c:forEach items="${tableMenuList}" var="tableMenu" varStatus="vs">
								<tr>
									<td class='center' style="width: 30px;">${vs.index+1}</td>
									<td>${tableMenu.type_name }</td>
									<td>${tableMenu.product_name }</td>
									<td><fmt:formatDate value="${tableMenu.create_time}" pattern="yyyy/MM/dd HH:mm:ss" /></td>
									<td>${tableMenu.creator_name}</td>
									<td style="width: 60px;">
										<div class='hidden-phone visible-desktop btn-group'>
										 	<a class='btn btn-mini btn-danger' title="删除" onclick="delTableMenu('${tableMenu.id }','${tableMenu.type_name }', '${tableMenu.product_name }');"><i class='icon-trash'></i></a>
										</div>
									</td>
								</tr>
							</c:forEach>
						</c:when>
						<c:otherwise>
							<tr class="main_info">
								<td colspan="14" class="center">没有相关数据</td>
							</tr>
						</c:otherwise>
					</c:choose>
					</tbody>
				</table>
				
			<div class="page-header position-relative">
				<table style="width:100%;">
					<tr>
						<td style="vertical-align:top;">
							<a class="btn btn-small btn-success" onclick="addTableMenu('${pageData.currentselecttableconstantsid }','${pageData.org_id }');">新增</a>
						</td>
						<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
					</tr>
				</table>
			</div>
			</form>
		<!-- PAGE CONTENT ENDS HERE -->
	  </div><!--/row-->
	</div><!--/#page-content-->
</div><!--/.fluid-container#main-container-->
		<!-- 返回顶部  -->
		<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
			<i class="icon-double-angle-up icon-only"></i>
		</a>
		
		<!-- 引入 -->
		<script type="text/javascript" src="static/1.9.1/jquery.min.js"></script>
		<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="static/js/ace-elements.min.js"></script>
		<script type="text/javascript" src="static/js/ace.min.js"></script>
		
		<script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->
		<!-- 引入 -->
		
		<!--引入弹窗组件start-->
		<script type="text/javascript" src="plugins/attention/zDialog/zDrag.js"></script>
		<script type="text/javascript" src="plugins/attention/zDialog/zDialog.js"></script>
		<!--引入弹窗组件end-->
		
		<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 下拉框 -->
		<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
		<!-- 引入 -->
		
		<script type="text/javascript" src="static/js/jquery.tips.js"></script><!--提示框-->
		<script type="text/javascript">
		
		//$(window.parent.hangge());
		$(top.hangge());
		
		//判断机构名称是否存在
		function addTableMenu(currentselecttableconstantsid, org_id){
			 if(currentselecttableconstantsid == 1){
				 alert("请先选择桌台类型！");
				 return false;
			 }
			 top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="新增";
			 diag.URL = '<%=basePath%>/tableMenu/goAddTableMenu.do?currentselecttableconstantsid=' + currentselecttableconstantsid + '&org_id=' + org_id;
			 diag.Width = 800;
			 diag.Height = 600;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('centerOfMainFrame').style.display == 'none'){
					 if('${page.currentPage}' == '0'){
						 top.jzts();
						 setTimeout("self.location.reload()",100);
					 }else{
						 nextPage(${page.currentPage});
					 }
				}
				diag.close();
			 };
			 diag.show();
		}
		
		//删除
		function delTableMenu(table_menu_id, msg, msg2){
			bootbox.confirm("确定要删除["+msg+"和"+msg2+"]的关联关系吗?", function(result) {
				if(result) {
					var url = "<%=basePath%>tableMenu/deleteTableMenu.do?table_menu_id=" + table_menu_id +"&tm="+new Date().getTime();
					$.get(url,function(data){
						if(data=="success"){
							nextPage(${page.currentPage});
						}
					});
				}
			});
		}
		</script>
		
		<script type="text/javascript">
			$(function() {
				//下拉框
				$(".chzn-select").chosen(); 
				$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			});
		</script>
	</body>
</html>